@@ -10,7 +10,7 @@ type DefaultBalance = <ink_env::DefaultEnvironment as Environment>::Balance;
1010
1111#[ ink:: chain_extension]
1212pub trait Psp22Extension {
13- type ErrorCode = Psp22ErrorCode ;
13+ type ErrorCode = Psp22Error ;
1414
1515 // PSP22 Metadata interfaces
1616
@@ -77,33 +77,21 @@ pub trait Psp22Extension {
7777 ) -> Result < ( ) > ;
7878}
7979
80- #[ derive( scale:: Encode , scale:: Decode ) ]
81- #[ cfg_attr( feature = "std" , derive( scale_info:: TypeInfo ) ) ]
82- pub enum Psp22ErrorCode {
83- TotalSupplyFailed ,
84- }
85-
8680#[ derive( scale:: Encode , scale:: Decode ) ]
8781#[ cfg_attr( feature = "std" , derive( scale_info:: TypeInfo ) ) ]
8882pub enum Psp22Error {
89- ErrorCode ( Psp22ErrorCode ) ,
83+ TotalSupplyFailed ,
9084}
9185
9286pub type Result < T > = core:: result:: Result < T , Psp22Error > ;
9387
94- impl From < Psp22ErrorCode > for Psp22Error {
95- fn from ( error_code : Psp22ErrorCode ) -> Self {
96- Self :: ErrorCode ( error_code)
97- }
98- }
99-
10088impl From < scale:: Error > for Psp22Error {
10189 fn from ( _: scale:: Error ) -> Self {
10290 panic ! ( "encountered unexpected invalid SCALE encoding" )
10391 }
10492}
10593
106- impl ink_env:: chain_extension:: FromStatusCode for Psp22ErrorCode {
94+ impl ink_env:: chain_extension:: FromStatusCode for Psp22Error {
10795 fn from_status_code ( status_code : u32 ) -> core:: result:: Result < ( ) , Self > {
10896 match status_code {
10997 0 => Ok ( ( ) ) ,
@@ -138,10 +126,13 @@ mod psp22_ext {
138126 Vec ,
139127 } ;
140128
129+ /// A chain extension which implements the PSP-22 fungible token standard.
130+ /// For more details see <https://github.com/w3f/PSPs/blob/master/PSPs/psp-22.md>
141131 #[ ink( storage) ]
142132 pub struct Psp22Extension { }
143133
144134 impl Psp22Extension {
135+ /// Creates a new instance of this contract.
145136 #[ ink( constructor) ]
146137 pub fn new ( ) -> Self {
147138 Psp22Extension { }
0 commit comments