Authorization
The user should grant authorization to allow smart contracts (including precompiled ones) to send messages on behalf of a user account. This is achieved by the Authorization.sol and GenericAuthorization.sol that provide the necessary functions to grant approvals and allowances. The precompiled contracts use these interfaces, AuthorizationI and GenericAuthorizationI, to allow users to approve the corresponding messages and amounts if needed.
Solidity Interfaces
Authorization.sol
Authorization.solFind the Solidity interface in the evmos/extensions repo.
GenericAuthorization.sol
GenericAuthorization.solFind the Solidity interface in the evmos/extensions repo.
Transactions
Authorization.sol
Authorization.solapproveApproves a list of Cosmos or IBC transactions with a specific amount of tokens
function approve( address spender, uint256 amount, string[] calldata methods ) external returns (bool approved);increaseAllowanceIncrease the allowance of a given spender by a specific amount of tokens for IBC transfer methods or staking
function increaseAllowance( address spender, uint256 amount, string[] calldata methods ) external returns (bool approved);decreaseAllowanceDecreases the allowance of a given spender by a specific amount of tokens for IBC transfer methods or staking
function decreaseAllowance( address spender, uint256 amount, string[] calldata methods ) external returns (bool approved);
GenericAuthorization.sol
GenericAuthorization.solapproveApproves a list of Cosmos message
function approve( address spender, string[] calldata methods ) external returns (bool approved);
Queries
Authorization.sol
Authorization.solallowanceReturns the remaining number of tokens that the spender will be allowed to spend on behalf of the owner through IBC transfer methods or staking. This is zero by default
function allowance( address owner, address spender, string calldata method ) external view returns (uint256 remaining);
Events
Authorization.sol
Authorization.solApprovalThis event is emitted when the allowance of a spender is set by a call to the
approvemethod. Thevaluefield specifies the new allowance and themethodsfield holds the information for which methods the approval was set.event Approval( address indexed owner, address indexed spender, string[] methods, uint256 value );AllowanceChangeThis event is emitted when the allowance of a spender is changed by a call to the decrease or increase allowance method. The
valuesfield specifies the new allowances and themethodsfield holds the information for which methods the approval was set.event AllowanceChange( address indexed owner, address indexed spender, string[] methods, uint256[] values );
GenericAuthorization.sol
GenericAuthorization.solApprovalThis event is emitted when the allowance of a spender is set by a call to the
approvemethod. Themethodsfield holds the information for which methods the approval was set.event Approval( address indexed owner, address indexed spender, string[] methods );
Last updated

