Mint Tokens (without dApp or Batch-Capable Wallet)
How to Mint Swap Token and Principal Token using a wallet that does not support atomic batch transactions
Provide cover by depositing collateral assets into a Cork Pool to mint shares of Cork Principal Token (cPT) and Cork Swap Token (cST), without using our dApp.
This "Mint" operation on Cork:
deposits Collateral Asset into one of many Cork Pools
mints share tokens (i.e. increases circulating supply of cPT & cST tokens of that Cork Pool)
How to Mint Shares of a Cork Pool via an Escrowed Deposit
You will be performing a trust-minimized escrowed operation. This is enforced by our escrow smart contract (CorkAdapter) to ensure that the end-user's desired intent is fulfilled properly with the expected outcomes. A deadline also ensures that your tokens are never stuck in an inconsistent state.
Prerequisites:
The Cork Pool's market id (bytes32).
A balance of Collateral Asset (CA) that pertains to this Cork Pool.
An EoA or Legacy wallet that does not support atomic batching — i.e not an EIP-5792 capable wallet such as a SAFE Wallet or an Account-Abstraction Wallet.
For your own safety, you are advised to use a wallet that supports clear signing (i.e. some form of calldata and bundle visualization) that improves opsec.
Completed a due diligence audit of the
safeDepositfunction onLine 126of the escrow manager contract (CorkAdapter) at its live deployment address via either:Github: Link
These instructions are for wallets that do not support atomic batch transactions. If you have an atomic EIP-5792 capable wallet such as SAFE Wallet by safe.global (previously Gnosis SAFE), it is recommended to use this guide instead as it requires fewer steps and saves gas.
Step 1: Open your Chain Explorer's Transaction Builder
Before we begin, check that you’re using the latest version of your browser by visiting whatismybrowser.com. If it’s not up to date, please update your browser to the latest version before continuing.
Connect your wallet to a Blockchain Explorer's Transaction Builder through this link: https://eth.blockscout.com/token/0x9D39A5DE30e57443BfF2A8307A4256c8797A3497?tab=write_contract


Step 2: Perform Transaction #1 – Allow spending of Collateral Assets by the Escrow Contract
Perform the 1st transaction to allow spending of collateral assets by our trust-minimized escrow manager contract (CorkAdapter):
Contract Address:
<ERC20 token address of Collateral Asset>Contract Method:
approvespender (escrow address):
0xCCcCcCCCcccCBaD6F772a511B337d9CCc9570407amount (of collateral): <wei amount of collateral asset to deposit, or allowance amount in wei>
How to obtain ERC20 token address of Collateral Asset
The Collateral asset (CA) address and Reference asset (REF) address may be obtained by calling CorkPoolManager.assets(poolId) with the Cork Pool id, via either:
By following these instructions:
Calculate the allowed amount in wei
To calculate the right wei-amount of collateral asset (CA), first obtain the token decimals of the collateral asset from its ERC20 contract address, then multiply your amount by 10^(erc20_decimal_of_CA).
For example, 10 USDC (which has 6 decimals) is represented as 10×106 , which is
10 000 000 in wei-amount.
Use a unit converter that allows you to adjust the token decimals, such as: https://converter.swiss-knife.xyz/eth

Input Transaction #1 Details
Press [Contract], then [Read/Write contract], then [Write].
Then scroll down to look for approve , expand the section, and input these details:
Contract Method:
approvespender (address):
0xCCcCcCCCcccCBaD6F772a511B337d9CCc9570407amount (uint256): <allowance amount in wei, copied from above>

Step 3: Perform Transaction #2 – Deposit/Mint with escrowed assets
Perform the 2nd transaction to mint cPT (Cork Principal Token) and cST (Cork Swap Token) by depositing escrowed collateral assets into a Cork Pool:
Contract Address:
0x6566194141eefa99Af43Bb5Aa71460Ca2Dc90245Contract Method:
multicallSend native ETH:
0bundle:
#1 Call (tuple):
to (address):
0xCCcCcCCCcccCBaD6F772a511B337d9CCc9570407The
toaddress is the call target, which is the escrow contract address
data (bytes):
The
calldataas copied from the erc20TransferFrom step.
value (uint256):
0The
valueis the wei amount of ETH or native token to forward. Set to 0 (none) in this case.
skipRevert (bool):
false,If
skipRevertis true, other planned calls will continue executing even if this call reverts. To reduce gas wastage, we must revert if the ERC20 transfer-to-escrow fails.
callbackHash (bytes32):
0x0000000000000000000000000000000000000000000000000000000000000000The
callbackHashshould be set to the hash of the reenter bundle data. Set to 0x0 (none) in this case.
#2 Call (tuple):
to (address):
0xCCcCcCCCcccCBaD6F772a511B337d9CCc9570407The
toaddress is the call target, which is the escrow contract address
data (bytes):
The
calldataas copied from the safeDeposit step.
value (uint256):
0The
valueis the wei amount of ETH or native token to forward. Set to 0 (none) in this case.
skipRevert (bool):
false,If
skipRevertis true, other planned calls will continue executing even if this call reverts. To protect escrowed funds, we must also revert the ERC20 transfer-to-escrow if the deposit fails.
callbackHash (bytes32):
0x0000000000000000000000000000000000000000000000000000000000000000The
callbackHashshould be set to the hash of the reenter bundle data. Set to 0x0 (none) in this case.
By following these instructions:
Input Erc20TransferFrom Parameters
Input these parameters into the "erc20TransferFrom" form linked here:
Contract Method:
erc20TransferFromparams:
token (address):
ERC20 token address of Collateral Asset
receiver (address)
The escrow contract address:
0xCCcCcCCCcccCBaD6F772a511B337d9CCc9570407
amount (uint256)
The wei amount of collateral assets to deposit. Must be lesser or the same as the wei amount allowed to be spent in Step 2. Copy and paste this from a token unit-converter.
Press [Copy calldata].

Optional: Verify copied Erc20TransferFrom calldata
Copy and paste the calldata into the Calldata Decoder linked here, and press [Decode] to verify your inputs:

Optional: Calculate the deadline in seconds since epoch
Choose a time in the future using an epoch-converter. We recommend setting it at least 1 hour from now to allow sufficient time for cosigning. Since the bundle executes atomically, time-limited ERC-20 permits are unnecessary, allowing this timestamp to be set as far in the future as desired. Use this timestamp as the deadline in the next step.
DO NOT attempt to retry this transaction before the deadline has passed.
Retrying earlier may result in duplicate operations, unintended consequences, or loss of funds.

If missing, scroll to the right of the page to see the copy button:

Input SafeDeposit Parameters
Input these parameters into the "safeDeposit" form linked here:
Contract Method:
safeDepositparams:
poolId (bytes32)
The cork pool market id
collateralAssetsIn (uint256)
The wei amount of collateral assets to deposit.
Use [Max]or input the same wei amount being transferred to escrow in the erc20TransferFrom Step.
receiver (address)
Your wallet address. Or the address to which shares (cST & cPT) will be minted.
minCptAndCstSharesOut (uint256)
The amount (non-denominated in wei) of Collateral Asset in the erc20TransferFrom Step, multiplied by 1018.
This guarantees the minimum amount of shares (cST & cPT) to receive.
deadline (uint256)
The deadline by which the transaction must be completed. Use [Now+1h] or copy from an epoch-converter.
Press [Copy calldata].

DO NOT attempt to retry this transaction before the deadline has passed.
Retrying earlier may result in duplicate operations, unintended consequences, or loss of funds.
Optional: Verify copied SafeDeposit calldata
Copy and paste the calldata into the Calldata Decoder linked here, and press [Decode] to verify your inputs:

Enter Address of Bundler3 contract
A Bundler contract is analogous to a Router contract, with the added guarantee that each step of the execution is explicitly defined rather than implicit.
This reduces the need to absolutely verify and place trust in esoteric code when interacting with smart contracts.
By ensuring that each step is verifiable by a mainstream enduser and his wallet, this system achieves greater end-to-end transparency and security.
Press the search button on the top-right of the Blockchain Explorer page and input the Bundler3 contract address as shown below.
Search by address:
0x6566194141eefa99Af43Bb5Aa71460Ca2Dc90245

Input Transaction #2 Details
Press [Contract], then [Read/Write contract], then [Write].
Then scroll down to look for multicall , expand the section, and input these details:
Contract Method:
multicallSend native ETH:
0bundle:
#1 Call (tuple):
to (address):
0xCCcCcCCCcccCBaD6F772a511B337d9CCc9570407The
toaddress is the call target, which is the escrow contract address
data (bytes):
The
calldataas copied from the erc20TransferFrom step.
value (uint256):
0The
valueis the wei amount of ETH or native token to forward. Set to 0 (none) in this case.
skipRevert (bool):
false,If
skipRevertis true, other planned calls will continue executing even if this call reverts. To reduce gas wastage, we must revert if the ERC20 transfer-to-escrow fails.
callbackHash (bytes32):
0x0000000000000000000000000000000000000000000000000000000000000000The
callbackHashshould be set to the hash of the reenter bundle data. Set to 0x0 (none) in this case.
#2 Call (tuple):
to (address):
0xCCcCcCCCcccCBaD6F772a511B337d9CCc9570407The
toaddress is the call target, which is the escrow contract address
data (bytes):
The
calldataas copied from the safeDeposit step.
value (uint256):
0The
valueis the wei amount of ETH or native token to forward. Set to 0 (none) in this case.
skipRevert (bool):
false,If
skipRevertis true, other planned calls will continue executing even if this call reverts. To protect escrowed funds, we must also revert the ERC20 transfer-to-escrow if the deposit fails.
callbackHash (bytes32):
0x0000000000000000000000000000000000000000000000000000000000000000The
callbackHashshould be set to the hash of the reenter bundle data. Set to 0x0 (none) in this case.

Sign and Submit Transaction #2
Unlock your connected wallet, and press [Simulate].
Cork Phoenix is designed with security as a core principle, going above and beyond on eliminating security footguns:
Our escrow smart contract immutably enforce all business invariants at every step of execution.
The protocol is architected such that all user actions can be fully simulated and reviewed as a single atomic transaction, enabling straightforward and reliable verification before committing anything onchain. (This includes legacy wallets without a builtin bundler.)
Key smart contracts have easily identifiable addresses, making review straightforward.
When you are satisfied with the simulation results, unlock your connected wallet again, and press [Write]. Then review and sign transaction #2 on your connected wallet.
If you see a "Missing gas limit" error, your connected wallet may not be whitelisted. Press [Reject] and then [Simulate] to confirm this is the case.


Step 4: Wait for Confirmation and Verify token balances
Once transaction #2 is confirmed, follow your wallet-specific instructions to add both cPT (Cork Principal Token) address and cST (Cork Swap Token) address into your wallet to check their balances.
The cPT address and cST address may be obtained by calling CorkPoolManager.shares(poolId) with the Cork Pool id, via either:
Etherscan (Closed source): Link
Blockscout (Open source): Link
Foundry Command Line:
cast call 0xccCCcCcCCccCfAE2Ee43F0E727A8c2969d74B9eC "shares(bytes32)(address corkPrincipalToken, address corkSwapToken)" <POOL_ID> --rpc-url https://eth.drpc.org
Last updated



