Router
The single entry point for users to interact with. The Router forwards the data to an Agent when executing a transaction.
Execute Transactions
The Router provides a single entry point for users to operate protocols in an intuitive and concise manner. Within the Router, users can execute operations by calling the execute()
function.
The execute()
function serves as the core interface for users to execute transactions. It requires three parameters:
permit2Datas
: The Permit2 data for pulling tokens from the user address.logics
: The operations for Protocolink to interact with other protocols.tokensReturn
: The specified tokens should be sent back to the user address at the end of the transaction.
Native tokens should be sent by users to the Router in msg.value.
Protocolink charges fees in the execute() function. Check more details of the Fees
Execute Transactions with API Data
Though Protocolink provides the Execute Transactions for users to operate protocols in a single transaction, it would take users a bunch of time to build the parameters. To solve this issue, Protocolink provides the executeWithSignerFee()
function.
The executeWithSignerFee()
function serves as the core interface for users to execute transactions with Protocolink API data. It requires five parameters:
permit2Datas
: The Permit2 data for pulling tokens from the user address.logicBatch
: The operations for Protocolink to interact with other protocols.signer
: The address that signed thelogicBatch
.signature
: The hash value of the signedlogicBatch
.tokensReturn
: The specified tokens should be sent back to the user address at the end of the transaction.
Execute Transactions with Delegations
Users (aka. delegators) can delegate their Agent to other users (aka. delegatee). When an Agent is delegated, the delegatee is allowed to send transactions on the delegator's behalf by calling the executeFor()
function.
The executeFor()
function serves as the core interface for delegatees to execute transactions. It requires four parameters:
user
: The delegator address.permit2Datas
: The Permit2 data for pulling tokens from the user address.logics
: The operations for Protocolink to interact with other protocols.tokensReturn
: The specified tokens should be sent back to the user address at the end of the transaction.
To delegate their Agent, delegators need to allow the delegatee with an expiry value. The expiry value ensures that the Agent is delegated within a period.
If users want to revoke the delegation from a delegatee before the expiry, users need to provide the delegatee address to the disallow() function.
With Delegations and API Data
Same as Execute Transactions with API Data, delegatees can call the Router contract with API data by using the executeForWithSignerFee()
function.
The executeForWithSignerFee()
function serves as the core interface for delegatees to execute transactions with API data. It requires six parameters:
user
: The delegator address.permit2Datas
: The Permit2 data for pulling tokens from the user address.logicBatch
: The operations for Protocolink to interact with other protocols.signer
: The address that signed thelogicBatch
.signature
: The hash value of the signedlogicBatch
.tokensReturn
: The specified tokens should be sent back to the user address at the end of the transaction.
Execute Transactions with Signatures
If users do not require a standalone delegatee, they can share their signature instead. A signature is signed by a delegator and it represents the hash value of the details
. The details
includes a nonce
value to ensure it can only be used once before the deadline
. Now, anyone with a signature can call the executeBySig()
function to send a transaction on behalf of the delegator.
The executeBySig()
function serves as the core interface for anyone to execute transactions with signatures. It requires three parameters:
details
: The operations for Protocolink to interact with other protocols.user
: The delegator address.signature
: The hash value of the signedlogicBatch
.
With Signatures and API Data
Same as Execute Transactions with API Data, anyone can call the Router contract with a signature and API data by using the executeBySigWithSignerFee()
function.
The executeBySigWithSignerFee()
function serves as the core interface for anyone to execute a transaction with the signatures and API data. It requires five parameters:
details
: The operations for Protocolink to interact with other protocols.user
: The delegator address.userSignature
: The hash value of the signeddetails
.signer
: The address that signed thelogicBatch
from thedetails
.signerSignature
: The hash value of the signedlogicBatch
.
Last updated