Data Types
DeploymentParameters
This struct defines parameters used by the TokenMasterRouter and factories for deploying tokens.
- tokenFactory: The token factory to use to deploy a specific pool type.
- tokenSalt: The salt value to use when deploying the token to control the deterministic address.
- tokenAddress: The deterministic address of the token that will be deployed.
- blockTransactionsFromUntrustedChannels: Initial setting for blocking transactions from untrusted channels.
- restrictPairingToLists: Initial setting for restricting pairing of the new token with other tokens.
- poolParams: The parameters that will be sent during token contract construction.
- maxInfrastructureFeeBPS: The maximum infrastructure fee that is allowed without reverting the deployment.
struct DeploymentParameters {
address tokenFactory;
bytes32 tokenSalt;
address tokenAddress;
bool blockTransactionsFromUntrustedChannels;
bool restrictPairingToLists;
PoolDeploymentParameters poolParams;
uint16 maxInfrastructureFeeBPS;
}
PoolDeploymentParameters
This struct defines parameters that are sent by token factories to create a token contract.
- name: The name of the token.
- symbol: The symbol of the token.
- decimals: The number of decimals of the token.
- initialOwner: Address to set as the initial owner of the token.
- pairedToken: Address of the token to pair with the new token, for native token use
address(0). - initialPairedTokenToDeposit: Amount of paired token to deposit to the new token pool.
- encodedInitializationArgs: Bytes array of ABI encoded initialization arguments to allow new pool types with different types of constructor arguments that are decoded during deployment.
- defaultTransferValidator: Address of the initial transfer validator for a token.
- useRouterForPairedTransfers: If true, the pool will default to allowing the router to transfer paired tokens during operations that require the paired token to transfer from the pool. This is useful when pairing with ERC20C tokens that utilize the default operator whitelist which includes the TokenMasterRouter but does not include individual token pools.
- partnerFeeRecipient: The address that will receive partner fee shares.
- partnerFeeBPS: The fee rate in BPS for partner fees.
struct PoolDeploymentParameters {
string name;
string symbol;
uint8 tokenDecimals;
address initialOwner;
address pairedToken;
uint256 initialPairedTokenToDeposit;
bytes encodedInitializationArgs;
address defaultTransferValidator;
bool useRouterForPairedTransfers;
address partnerFeeRecipient;
uint256 partnerFeeBPS;
}
BuyOrder
This struct defines buy order base parameters.
- tokenMasterToken: The address of the TokenMaster token to buy.
- tokensToBuy: The amount of tokens to buy.
- pairedValueIn: The amount of paired tokens to transfer in to the token contract for the purchase.
struct BuyOrder {
address tokenMasterToken;
uint256 tokensToBuy;
uint256 pairedValueIn;
}
PermitTransfer
This struct defines a permit transfer parameters used in advanced buy orders that utilize PermitC advanced permit transfer functionality.
- permitProcessor: The address of the PermitC-compliant permit processor to use for the transfer.
- nonce: The permit nonce to use for the permit transfer signature validation.
- permitAmount: The amount that the permit was signed for.
- expiration: The time, in seconds since the Unix epoch, that the permit will expire.
- signedPermit: The permit signature bytes authorizing the transfer.
struct PermitTransfer {
address permitProcessor;
uint256 nonce;
uint256 permitAmount;
uint256 expiration;
bytes signedPermit;
}
SellOrder
This struct defines sell order base parameters.
- tokenMasterToken: The address of the TokenMaster token to sell.
- tokensToSell: The amount of tokens to sell.
- minimumOut: The minimum output of paired tokens to be received by the seller without the transaction reverting.
struct SellOrder {
address tokenMasterToken;
uint256 tokensToSell;
uint256 minimumOut;
}
SpendOrder
This struct defines spend order base parameters. It must be combined with a SignedOrder to execute a token spend transaction.
- tokenMasterToken: The address of the TokenMaster token to spend.
- multiplier: The multiplier of the signed spend order's
baseValue, adjusted by an oracle if specified, to be spent. - maxAmountToSpend: The maximum amount the spender will spend on the order without the transaction reverting.
struct SpendOrder {
address tokenMasterToken;
uint256 multiplier;
uint256 maxAmountToSpend;
}
SignedOrder
This struct defines advanced order execution parameters for advanced buy orders, advanced sell orders and spend orders.
- creatorIdentifier: A value specified by the creator to identify the order for any onchain or offchain benefits to the order executor for executing the order.
- tokenMasterOracle: An address for an onchain oracle that can adjust the
baseValuefor an advanced order. - baseToken: An address for a token to base the
baseValueon when adjusting value through a TokenMaster Oracle. - baseValue: The amount of token required for the order to be executed.
- If
tokenMasterOracleis set toaddress(0), thebaseTokenwill not be utilized and the advanced order will execute withbaseValuebeing the amount of the TokenMaster token to be required for the order.
- If
- maxPerWallet: The maximum amount per wallet that can be executed on the order. For buy and sell advanced orders this amount is in the TokenMaster token amount, for spend orders it is multipliers.
- maxPerWallet: The maximum amount for all wallets that can be executed on the order. For buy and sell advanced orders this amount is in the TokenMaster token amount, for spend orders it is multipliers.
- expiration: The time, in seconds since the Unix epoch, that the order will expire.
- hook: An address for an onchain hook for an order to execute after the buy, sell or spend is executed.
- signature: The signature from an allowed order signer to authorize the order.
- cosignature: The cosignature from the cosigner specified by the order signer.
- hookExtraData: Extra data to send with the call to the onchain hook contract.
- oracleExtraData: Extra data to send with the call to the oracle contract.
struct SignedOrder {
bytes32 creatorIdentifier;
address tokenMasterOracle;
address baseToken;
uint256 baseValue;
uint256 maxPerWallet;
uint256 maxTotal;
uint256 expiration;
address hook;
SignatureECDSA signature;
Cosignature cosignature;
bytes hookExtraData;
bytes oracleExtraData;
}
SignatureECDSA
The v, r, and s components of an ECDSA signature. For more information refer to this article.
struct SignatureECDSA {
uint256 v;
bytes32 r;
bytes32 s;
}
Cosignature
This struct defines the cosignature for verifying an order that is a cosigned order.
- signer: The address that signed the cosigned order. This must match the cosigner that is part of the order signature.
- expiration: The time, in seconds since the Unix epoch, that the cosignature will expire.
- The
v,r, andscomponents of an ECDSA signature. For more information refer to this article.
struct Cosignature {
address signer;
uint256 expiration;
uint256 v;
bytes32 r;
bytes32 s;
}
