This smart contract, deployed on the mySubnet network at the contract address 0x17aB05351fC94a1a67Bf3f56DdbB941aE6c63E25
, serves as a vault for managing deposits and withdrawals of a specified ERC-20 token. Users can deposit tokens, minting shares in proportion to the deposited amount, and later withdraw a corresponding amount of tokens based on the shares they hold.
- Contract Address:
0x17aB05351fC94a1a67Bf3f56DdbB941aE6c63E25
- Network: mySubnet
- License: MIT
Users can deposit ERC-20 tokens into the vault by calling the deposit
function. This function calculates the number of shares to mint based on the deposited amount and the current total supply of shares.
function deposit(uint _amount) external
Users can withdraw their tokens from the vault by calling the withdraw
function. This function calculates the amount to withdraw based on the number of shares burned and the current total supply of shares.
function withdraw(uint _shares) external
The contract includes an interface for ERC-20 functionality, providing basic token operations like checking balances, transferring tokens, and approving token transfers.
interface IERC20 {
// ERC-20 functions...
}
-
Token Approval: Before depositing, ensure that you have approved the contract to spend your ERC-20 tokens. Use the ERC-20
approve
function to grant the necessary permission. -
Deposit: Call the
deposit
function with the desired amount of tokens to mint corresponding shares. -
Withdraw: Call the
withdraw
function with the number of shares to burn and receive the proportional amount of tokens. -
Monitor Balances: Keep track of your token balances and shares to manage deposits and withdrawals effectively.
- This smart contract is provided under the MIT license, and users are encouraged to review and understand the code before interacting with it.
- Exercise caution and perform thorough testing when using smart contracts on the blockchain.
- The contract is deployed on the isaacSubnet network; ensure compatibility before interacting.# subnet-avalanche