Climate Impact
- 🌵 Maximizing Climate Impact
- 🧑⚖️ Project Review Process
- 🏛 Climate Council
Green Tokens
Building on Green Tokens
📱 Building dApps
How to integrate Spirals into your web apps, mobile apps, etc.
The following examples use an open-source library of React hooks built for
Ethereum called Wagmi. Please create a new file
GreenTokenVaultInterface.json
in your project to import the ABI and get
started on these code examples 👇
{
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "_assetsDeposited",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "_sharesMinted",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "_receiver",
"type": "address"
}
],
"name": "Deposit",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "_owner",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "_receiver",
"type": "address"
}
],
"name": "WithdrawAsset",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "asset",
"outputs": [
{
"internalType": "contract IERC20Upgradeable",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amountYieldAsset",
"type": "uint256"
}
],
"name": "convertToAsset",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amountAsset",
"type": "uint256"
}
],
"name": "convertToYieldAsset",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "address",
"name": "_receiver",
"type": "address"
}
],
"name": "deposit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_receiver",
"type": "address"
}
],
"name": "depositETH",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "getAPY",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_address",
"type": "address"
}
],
"name": "getYield",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "paused",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalYield",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalYieldUSD",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "address",
"name": "_receiver",
"type": "address"
},
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "address",
"name": "_receiver",
"type": "address"
},
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"name": "withdrawYieldAsset",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_user",
"type": "address"
}
],
"name": "withdrawals",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "yieldAsset",
"outputs": [
{
"internalType": "contract IERC20Upgradeable",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": {
"object": "0x",
"sourceMap": "",
"linkReferences": {}
},
"deployedBytecode": {
"object": "0x",
"sourceMap": "",
"linkReferences": {}
},
"methodIdentifiers": {
"allowance(address,address)": "dd62ed3e",
"approve(address,uint256)": "095ea7b3",
"asset()": "38d52e0f",
"balanceOf(address)": "70a08231",
"convertToAsset(uint256)": "4b5a2465",
"convertToYieldAsset(uint256)": "f8d368ee",
"decimals()": "313ce567",
"deposit(uint256,address)": "6e553f65",
"depositETH(address)": "2d2da806",
"getAPY()": "d2cbf7ad",
"getYield(address)": "64c33977",
"name()": "06fdde03",
"owner()": "8da5cb5b",
"paused()": "5c975abb",
"symbol()": "95d89b41",
"totalSupply()": "18160ddd",
"totalYield()": "01418205",
"totalYieldUSD()": "8471c44d",
"transfer(address,uint256)": "a9059cbb",
"transferFrom(address,address,uint256)": "23b872dd",
"withdraw(uint256,address,address)": "b460af94",
"withdrawYieldAsset(uint256,address,address)": "284e7335",
"withdrawals(address)": "7a9262a2",
"yieldAsset()": "095b1837"
},
"rawMetadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_assetsDeposited\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_sharesMinted\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"WithdrawAsset\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"asset\",\"outputs\":[{\"internalType\":\"contract IERC20Upgradeable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountYieldAsset\",\"type\":\"uint256\"}],\"name\":\"convertToAsset\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountAsset\",\"type\":\"uint256\"}],\"name\":\"convertToYieldAsset\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"depositETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAPY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"getYield\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalYield\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalYieldUSD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"withdrawYieldAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"withdrawals\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"yieldAsset\",\"outputs\":[{\"internalType\":\"contract IERC20Upgradeable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.\"},\"approve(address,uint256)\":{\"details\":\"Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the amount of tokens owned by `account`.\"},\"decimals()\":{\"details\":\"Returns the decimals places of the token.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token.\"},\"totalSupply()\":{\"details\":\"Returns the amount of tokens in existence.\"},\"transfer(address,uint256)\":{\"details\":\"Moves `amount` tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves `amount` tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/interfaces/GreenTokenVaultInterface.sol\":\"GreenTokenVaultInterface\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@celo-foundry/=lib/celo-foundry/src/\",\":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/\",\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":@rocketpool/=lib/rocketpool/contracts/\",\":@solmate/=lib/solmate/src/\",\":@staked-celo/=lib/staked-celo/contracts/\",\":@yearn-vaults/=lib/yearn-vaults/contracts/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":lido-dao/=lib/lido-dao/\",\":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\",\":rocketpool/=lib/rocketpool/\",\":solmate/=lib/solmate/src/\",\":staked-celo/=lib/staked-celo/contracts/\",\":yearn-vaults/=lib/yearn-vaults/contracts/\"]},\"sources\":{\"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d7fc8396619de513c96b6e00301b88dd790e83542aab918425633a5f7297a15a\",\"dweb:/ipfs/QmXbP4kiZyp7guuS7xe8KaybnwkRPGrBc2Kbi3vhcTfpxb\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6eb2fd1e9894dbe778f4b8131adecebe570689e63cf892f4e21257bfe1252497\",\"dweb:/ipfs/QmXgUGNfZvrn6N2miv3nooSs7Jm34A41qz94fu2GtDFcx8\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol\":{\"keccak256\":\"0x40c636b4572ff5f1dc50cf22097e93c0723ee14eff87e99ac2b02636eeca1250\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9c7d1f5e15633ab912b74c2f57e24559e66b03232300d4b27ff0f25bc452ecad\",\"dweb:/ipfs/QmYTJkc1cntYkKQ1Tu11nBcJLakiy93Tjytc4XHELo4GmR\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\":{\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://75b47c3aeca7b66ea6752f8be020ec5c1c502de6ec9065272dae23d3a52196e2\",\"dweb:/ipfs/QmUebPMHv16tYKFh5BmBQkMfRFb5b8UZ2RgVwdjxCeufVF\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\":{\"keccak256\":\"0x605434219ebbe4653f703640f06969faa5a1d78f0bfef878e5ddbb1ca369ceeb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4c9c634f99dd02d73ce7498b03a6305e251c05eeebb71457306561c1fab0fa7d\",\"dweb:/ipfs/QmbYRBbZHy8YoaQKXdPryiL3CSS7uUaRfRYi1TUj9cTqJQ\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"keccak256\":\"0xf8313972e73a49ff9a8c2dee0b9a07a3585bc4d077bd8a9670ebdd76ff390177\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3fc2a0888fca21e976b4b77ca46891f547ff339a8175bc0a6461a62ce65aa89a\",\"dweb:/ipfs/QmYDpaGK98esv36MBanhjgzpS7QcisrsVMzttPknvxWhRG\"]},\"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d6520943ea55fdf5f0bafb39ed909f64de17051bc954ff3e88c9e5621412c79c\",\"dweb:/ipfs/QmWZ4rAKTQbNG2HxGs46AcTXShsVytKeLs7CUCdCSv5N7a\"]},\"src/interfaces/GreenTokenVaultInterface.sol\":{\"keccak256\":\"0x9e798153004dd71351d7051c4421c38ae330fd96a9e76d12da1964751bce3ea1\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://995708fe49064f0f1abe5570339b79042603dffde2e9c9535b5aaad69193ea2b\",\"dweb:/ipfs/QmezY7gPPt64Ncz3CkkKXNKootCWdvzinMgwcUoo2THGr7\"]},\"src/interfaces/ImpactVaultInterface.sol\":{\"keccak256\":\"0xe9621bfde4adf31fe4d27cb601a46bbb142fa3741517eba4be6b21398c71510a\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://079fe8ed3b869f938ad45a97da9d2ac9c4d914c96202623167eff00cdd5a0c1b\",\"dweb:/ipfs/QmRR3Q2C2iDLDbqFSHrAvfHpy356ySczTR5PViW7gW2sb7\"]}},\"version\":1}",
"metadata": {
"compiler": {
"version": "0.8.11+commit.d7f03943"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address",
"indexed": true
},
{
"internalType": "address",
"name": "spender",
"type": "address",
"indexed": true
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256",
"indexed": false
}
],
"type": "event",
"name": "Approval",
"anonymous": false
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_assetsDeposited",
"type": "uint256",
"indexed": false
},
{
"internalType": "uint256",
"name": "_sharesMinted",
"type": "uint256",
"indexed": false
},
{
"internalType": "address",
"name": "_receiver",
"type": "address",
"indexed": false
}
],
"type": "event",
"name": "Deposit",
"anonymous": false
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address",
"indexed": true
},
{
"internalType": "address",
"name": "to",
"type": "address",
"indexed": true
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256",
"indexed": false
}
],
"type": "event",
"name": "Transfer",
"anonymous": false
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256",
"indexed": false
},
{
"internalType": "address",
"name": "_owner",
"type": "address",
"indexed": false
},
{
"internalType": "address",
"name": "_receiver",
"type": "address",
"indexed": false
}
],
"type": "event",
"name": "WithdrawAsset",
"anonymous": false
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
]
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function",
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
]
},
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "function",
"name": "asset",
"outputs": [
{
"internalType": "contract IERC20Upgradeable",
"name": "",
"type": "address"
}
]
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
]
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amountYieldAsset",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function",
"name": "convertToAsset",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
]
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amountAsset",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function",
"name": "convertToYieldAsset",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
]
},
{
"inputs": [],
"stateMutability": "view",
"type": "function",
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
]
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "address",
"name": "_receiver",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function",
"name": "deposit"
},
{
"inputs": [
{
"internalType": "address",
"name": "_receiver",
"type": "address"
}
],
"stateMutability": "payable",
"type": "function",
"name": "depositETH"
},
{
"inputs": [],
"stateMutability": "view",
"type": "function",
"name": "getAPY",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
]
},
{
"inputs": [
{
"internalType": "address",
"name": "_address",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"name": "getYield",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
]
},
{
"inputs": [],
"stateMutability": "view",
"type": "function",
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
]
},
{
"inputs": [],
"stateMutability": "view",
"type": "function",
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
]
},
{
"inputs": [],
"stateMutability": "view",
"type": "function",
"name": "paused",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
]
},
{
"inputs": [],
"stateMutability": "view",
"type": "function",
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
]
},
{
"inputs": [],
"stateMutability": "view",
"type": "function",
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
]
},
{
"inputs": [],
"stateMutability": "view",
"type": "function",
"name": "totalYield",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
]
},
{
"inputs": [],
"stateMutability": "view",
"type": "function",
"name": "totalYieldUSD",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
]
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function",
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
]
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function",
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
]
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "address",
"name": "_receiver",
"type": "address"
},
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function",
"name": "withdraw"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "address",
"name": "_receiver",
"type": "address"
},
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function",
"name": "withdrawYieldAsset"
},
{
"inputs": [
{
"internalType": "address",
"name": "_user",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"name": "withdrawals",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
]
},
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "function",
"name": "yieldAsset",
"outputs": [
{
"internalType": "contract IERC20Upgradeable",
"name": "",
"type": "address"
}
]
}
],
"devdoc": {
"kind": "dev",
"methods": {
"allowance(address,address)": {
"details": "Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called."
},
"approve(address,uint256)": {
"details": "Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event."
},
"balanceOf(address)": {
"details": "Returns the amount of tokens owned by `account`."
},
"decimals()": {
"details": "Returns the decimals places of the token."
},
"name()": {
"details": "Returns the name of the token."
},
"symbol()": {
"details": "Returns the symbol of the token."
},
"totalSupply()": {
"details": "Returns the amount of tokens in existence."
},
"transfer(address,uint256)": {
"details": "Moves `amount` tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event."
},
"transferFrom(address,address,uint256)": {
"details": "Moves `amount` tokens from `from` to `to` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event."
}
},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"remappings": [
":@celo-foundry/=lib/celo-foundry/src/",
":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
":@rocketpool/=lib/rocketpool/contracts/",
":@solmate/=lib/solmate/src/",
":@staked-celo/=lib/staked-celo/contracts/",
":@yearn-vaults/=lib/yearn-vaults/contracts/",
":ds-test/=lib/forge-std/lib/ds-test/src/",
":forge-std/=lib/forge-std/src/",
":lido-dao/=lib/lido-dao/",
":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
":openzeppelin-contracts/=lib/openzeppelin-contracts/",
":rocketpool/=lib/rocketpool/",
":solmate/=lib/solmate/src/",
":staked-celo/=lib/staked-celo/contracts/",
":yearn-vaults/=lib/yearn-vaults/contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"bytecodeHash": "ipfs"
},
"compilationTarget": {
"src/interfaces/GreenTokenVaultInterface.sol": "GreenTokenVaultInterface"
},
"libraries": {}
},
"sources": {
"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol": {
"keccak256": "0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888",
"urls": [
"bzz-raw://d7fc8396619de513c96b6e00301b88dd790e83542aab918425633a5f7297a15a",
"dweb:/ipfs/QmXbP4kiZyp7guuS7xe8KaybnwkRPGrBc2Kbi3vhcTfpxb"
],
"license": "MIT"
},
"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": {
"keccak256": "0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e",
"urls": [
"bzz-raw://6eb2fd1e9894dbe778f4b8131adecebe570689e63cf892f4e21257bfe1252497",
"dweb:/ipfs/QmXgUGNfZvrn6N2miv3nooSs7Jm34A41qz94fu2GtDFcx8"
],
"license": "MIT"
},
"lib/openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol": {
"keccak256": "0x40c636b4572ff5f1dc50cf22097e93c0723ee14eff87e99ac2b02636eeca1250",
"urls": [
"bzz-raw://9c7d1f5e15633ab912b74c2f57e24559e66b03232300d4b27ff0f25bc452ecad",
"dweb:/ipfs/QmYTJkc1cntYkKQ1Tu11nBcJLakiy93Tjytc4XHELo4GmR"
],
"license": "MIT"
},
"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol": {
"keccak256": "0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff",
"urls": [
"bzz-raw://75b47c3aeca7b66ea6752f8be020ec5c1c502de6ec9065272dae23d3a52196e2",
"dweb:/ipfs/QmUebPMHv16tYKFh5BmBQkMfRFb5b8UZ2RgVwdjxCeufVF"
],
"license": "MIT"
},
"lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": {
"keccak256": "0x605434219ebbe4653f703640f06969faa5a1d78f0bfef878e5ddbb1ca369ceeb",
"urls": [
"bzz-raw://4c9c634f99dd02d73ce7498b03a6305e251c05eeebb71457306561c1fab0fa7d",
"dweb:/ipfs/QmbYRBbZHy8YoaQKXdPryiL3CSS7uUaRfRYi1TUj9cTqJQ"
],
"license": "MIT"
},
"lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": {
"keccak256": "0xf8313972e73a49ff9a8c2dee0b9a07a3585bc4d077bd8a9670ebdd76ff390177",
"urls": [
"bzz-raw://3fc2a0888fca21e976b4b77ca46891f547ff339a8175bc0a6461a62ce65aa89a",
"dweb:/ipfs/QmYDpaGK98esv36MBanhjgzpS7QcisrsVMzttPknvxWhRG"
],
"license": "MIT"
},
"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": {
"keccak256": "0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149",
"urls": [
"bzz-raw://d6520943ea55fdf5f0bafb39ed909f64de17051bc954ff3e88c9e5621412c79c",
"dweb:/ipfs/QmWZ4rAKTQbNG2HxGs46AcTXShsVytKeLs7CUCdCSv5N7a"
],
"license": "MIT"
},
"src/interfaces/GreenTokenVaultInterface.sol": {
"keccak256": "0x9e798153004dd71351d7051c4421c38ae330fd96a9e76d12da1964751bce3ea1",
"urls": [
"bzz-raw://995708fe49064f0f1abe5570339b79042603dffde2e9c9535b5aaad69193ea2b",
"dweb:/ipfs/QmezY7gPPt64Ncz3CkkKXNKootCWdvzinMgwcUoo2THGr7"
],
"license": "Apache-2.0"
},
"src/interfaces/ImpactVaultInterface.sol": {
"keccak256": "0xe9621bfde4adf31fe4d27cb601a46bbb142fa3741517eba4be6b21398c71510a",
"urls": [
"bzz-raw://079fe8ed3b869f938ad45a97da9d2ac9c4d914c96202623167eff00cdd5a0c1b",
"dweb:/ipfs/QmRR3Q2C2iDLDbqFSHrAvfHpy356ySczTR5PViW7gW2sb7"
],
"license": "Apache-2.0"
}
},
"version": 1
},
"ast": {
"absolutePath": "src/interfaces/GreenTokenVaultInterface.sol",
"id": 35830,
"exportedSymbols": {
"AddressUpgradeable": [
28875
],
"ContextUpgradeable": [
28917
],
"GreenTokenVaultInterface": [
35829
],
"IERC20MetadataUpgradeable": [
28094
],
"IERC20Upgradeable": [
27348
],
"ImpactVaultInterface": [
38834
],
"Initializable": [
26459
],
"OwnableUpgradeable": [
26140
],
"PausableUpgradeable": [
26586
]
},
"nodeType": "SourceUnit",
"src": "100:2845:76",
"nodes": [
{
"id": 35709,
"nodeType": "PragmaDirective",
"src": "100:23:76",
"nodes": [],
"literals": [
"solidity",
"0.8",
".11"
]
},
{
"id": 35710,
"nodeType": "ImportDirective",
"src": "125:49:76",
"nodes": [],
"absolutePath": "src/interfaces/ImpactVaultInterface.sol",
"file": "src/interfaces/ImpactVaultInterface.sol",
"nameLocation": "-1:-1:-1",
"scope": 35830,
"sourceUnit": 38835,
"symbolAliases": [],
"unitAlias": ""
},
{
"id": 35711,
"nodeType": "ImportDirective",
"src": "175:98:76",
"nodes": [],
"absolutePath": "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol",
"file": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol",
"nameLocation": "-1:-1:-1",
"scope": 35830,
"sourceUnit": 28095,
"symbolAliases": [],
"unitAlias": ""
},
{
"id": 35712,
"nodeType": "ImportDirective",
"src": "274:78:76",
"nodes": [],
"absolutePath": "lib/openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol",
"file": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol",
"nameLocation": "-1:-1:-1",
"scope": 35830,
"sourceUnit": 26587,
"symbolAliases": [],
"unitAlias": ""
},
{
"id": 35713,
"nodeType": "ImportDirective",
"src": "353:75:76",
"nodes": [],
"absolutePath": "lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol",
"file": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol",
"nameLocation": "-1:-1:-1",
"scope": 35830,
"sourceUnit": 26141,
"symbolAliases": [],
"unitAlias": ""
},
{
"id": 35829,
"nodeType": "ContractDefinition",
"src": "430:2514:76",
"nodes": [
{
"id": 35723,
"nodeType": "EventDefinition",
"src": "500:112:76",
"nodes": [],
"anonymous": false,
"name": "Deposit",
"nameLocation": "506:7:76",
"parameters": {
"id": 35722,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35717,
"indexed": false,
"mutability": "mutable",
"name": "_assetsDeposited",
"nameLocation": "531:16:76",
"nodeType": "VariableDeclaration",
"scope": 35723,
"src": "523:24:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35716,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "523:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 35719,
"indexed": false,
"mutability": "mutable",
"name": "_sharesMinted",
"nameLocation": "565:13:76",
"nodeType": "VariableDeclaration",
"scope": 35723,
"src": "557:21:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35718,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "557:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 35721,
"indexed": false,
"mutability": "mutable",
"name": "_receiver",
"nameLocation": "596:9:76",
"nodeType": "VariableDeclaration",
"scope": 35723,
"src": "588:17:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35720,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "588:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "513:98:76"
}
},
{
"id": 35731,
"nodeType": "EventDefinition",
"src": "617:72:76",
"nodes": [],
"anonymous": false,
"name": "WithdrawAsset",
"nameLocation": "623:13:76",
"parameters": {
"id": 35730,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35725,
"indexed": false,
"mutability": "mutable",
"name": "_amount",
"nameLocation": "645:7:76",
"nodeType": "VariableDeclaration",
"scope": 35731,
"src": "637:15:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35724,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "637:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 35727,
"indexed": false,
"mutability": "mutable",
"name": "_owner",
"nameLocation": "662:6:76",
"nodeType": "VariableDeclaration",
"scope": 35731,
"src": "654:14:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35726,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "654:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 35729,
"indexed": false,
"mutability": "mutable",
"name": "_receiver",
"nameLocation": "678:9:76",
"nodeType": "VariableDeclaration",
"scope": 35731,
"src": "670:17:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35728,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "670:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "636:52:76"
}
},
{
"id": 35736,
"nodeType": "FunctionDefinition",
"src": "695:47:76",
"nodes": [],
"functionSelector": "5c975abb",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "paused",
"nameLocation": "704:6:76",
"parameters": {
"id": 35732,
"nodeType": "ParameterList",
"parameters": [],
"src": "710:2:76"
},
"returnParameters": {
"id": 35735,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35734,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35736,
"src": "736:4:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 35733,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "736:4:76",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
}
],
"src": "735:6:76"
},
"scope": 35829,
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"id": 35741,
"nodeType": "FunctionDefinition",
"src": "748:49:76",
"nodes": [],
"functionSelector": "8da5cb5b",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "owner",
"nameLocation": "757:5:76",
"parameters": {
"id": 35737,
"nodeType": "ParameterList",
"parameters": [],
"src": "762:2:76"
},
"returnParameters": {
"id": 35740,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35739,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35741,
"src": "788:7:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35738,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "788:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "787:9:76"
},
"scope": 35829,
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"id": 35747,
"nodeType": "FunctionDefinition",
"src": "840:54:76",
"nodes": [],
"functionSelector": "38d52e0f",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "asset",
"nameLocation": "849:5:76",
"parameters": {
"id": 35742,
"nodeType": "ParameterList",
"parameters": [],
"src": "854:2:76"
},
"returnParameters": {
"id": 35746,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35745,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35747,
"src": "875:17:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Upgradeable_$27348",
"typeString": "contract IERC20Upgradeable"
},
"typeName": {
"id": 35744,
"nodeType": "UserDefinedTypeName",
"pathNode": {
"id": 35743,
"name": "IERC20Upgradeable",
"nodeType": "IdentifierPath",
"referencedDeclaration": 27348,
"src": "875:17:76"
},
"referencedDeclaration": 27348,
"src": "875:17:76",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Upgradeable_$27348",
"typeString": "contract IERC20Upgradeable"
}
},
"visibility": "internal"
}
],
"src": "874:19:76"
},
"scope": 35829,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"id": 35753,
"nodeType": "FunctionDefinition",
"src": "950:59:76",
"nodes": [],
"functionSelector": "095b1837",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "yieldAsset",
"nameLocation": "959:10:76",
"parameters": {
"id": 35748,
"nodeType": "ParameterList",
"parameters": [],
"src": "969:2:76"
},
"returnParameters": {
"id": 35752,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35751,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35753,
"src": "990:17:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Upgradeable_$27348",
"typeString": "contract IERC20Upgradeable"
},
"typeName": {
"id": 35750,
"nodeType": "UserDefinedTypeName",
"pathNode": {
"id": 35749,
"name": "IERC20Upgradeable",
"nodeType": "IdentifierPath",
"referencedDeclaration": 27348,
"src": "990:17:76"
},
"referencedDeclaration": 27348,
"src": "990:17:76",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Upgradeable_$27348",
"typeString": "contract IERC20Upgradeable"
}
},
"visibility": "internal"
}
],
"src": "989:19:76"
},
"scope": 35829,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"id": 35760,
"nodeType": "FunctionDefinition",
"src": "1062:62:76",
"nodes": [],
"functionSelector": "6e553f65",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "deposit",
"nameLocation": "1071:7:76",
"parameters": {
"id": 35758,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35755,
"mutability": "mutable",
"name": "_amount",
"nameLocation": "1087:7:76",
"nodeType": "VariableDeclaration",
"scope": 35760,
"src": "1079:15:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35754,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1079:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 35757,
"mutability": "mutable",
"name": "_receiver",
"nameLocation": "1104:9:76",
"nodeType": "VariableDeclaration",
"scope": 35760,
"src": "1096:17:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35756,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1096:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "1078:36:76"
},
"returnParameters": {
"id": 35759,
"nodeType": "ParameterList",
"parameters": [],
"src": "1123:0:76"
},
"scope": 35829,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"id": 35765,
"nodeType": "FunctionDefinition",
"src": "1185:56:76",
"nodes": [],
"functionSelector": "2d2da806",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "depositETH",
"nameLocation": "1194:10:76",
"parameters": {
"id": 35763,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35762,
"mutability": "mutable",
"name": "_receiver",
"nameLocation": "1213:9:76",
"nodeType": "VariableDeclaration",
"scope": 35765,
"src": "1205:17:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35761,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1205:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "1204:19:76"
},
"returnParameters": {
"id": 35764,
"nodeType": "ParameterList",
"parameters": [],
"src": "1240:0:76"
},
"scope": 35829,
"stateMutability": "payable",
"virtual": false,
"visibility": "external"
},
{
"id": 35774,
"nodeType": "FunctionDefinition",
"src": "1307:109:76",
"nodes": [],
"functionSelector": "b460af94",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "withdraw",
"nameLocation": "1316:8:76",
"parameters": {
"id": 35772,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35767,
"mutability": "mutable",
"name": "_amount",
"nameLocation": "1342:7:76",
"nodeType": "VariableDeclaration",
"scope": 35774,
"src": "1334:15:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35766,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1334:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 35769,
"mutability": "mutable",
"name": "_receiver",
"nameLocation": "1367:9:76",
"nodeType": "VariableDeclaration",
"scope": 35774,
"src": "1359:17:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35768,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1359:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 35771,
"mutability": "mutable",
"name": "_owner",
"nameLocation": "1394:6:76",
"nodeType": "VariableDeclaration",
"scope": 35774,
"src": "1386:14:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35770,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1386:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "1324:82:76"
},
"returnParameters": {
"id": 35773,
"nodeType": "ParameterList",
"parameters": [],
"src": "1415:0:76"
},
"scope": 35829,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"id": 35783,
"nodeType": "FunctionDefinition",
"src": "1604:119:76",
"nodes": [],
"functionSelector": "284e7335",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "withdrawYieldAsset",
"nameLocation": "1613:18:76",
"parameters": {
"id": 35781,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35776,
"mutability": "mutable",
"name": "_amount",
"nameLocation": "1649:7:76",
"nodeType": "VariableDeclaration",
"scope": 35783,
"src": "1641:15:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35775,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1641:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 35778,
"mutability": "mutable",
"name": "_receiver",
"nameLocation": "1674:9:76",
"nodeType": "VariableDeclaration",
"scope": 35783,
"src": "1666:17:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35777,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1666:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 35780,
"mutability": "mutable",
"name": "_owner",
"nameLocation": "1701:6:76",
"nodeType": "VariableDeclaration",
"scope": 35783,
"src": "1693:14:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35779,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1693:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "1631:82:76"
},
"returnParameters": {
"id": 35782,
"nodeType": "ParameterList",
"parameters": [],
"src": "1722:0:76"
},
"scope": 35829,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "external"
},
{
"id": 35792,
"nodeType": "FunctionDefinition",
"src": "1946:101:76",
"nodes": [],
"functionSelector": "7a9262a2",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "withdrawals",
"nameLocation": "1955:11:76",
"parameters": {
"id": 35786,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35785,
"mutability": "mutable",
"name": "_user",
"nameLocation": "1975:5:76",
"nodeType": "VariableDeclaration",
"scope": 35792,
"src": "1967:13:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35784,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1967:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "1966:15:76"
},
"returnParameters": {
"id": 35791,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35788,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35792,
"src": "2029:7:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35787,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2029:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 35790,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35792,
"src": "2038:7:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35789,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2038:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2028:18:76"
},
"scope": 35829,
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"id": 35797,
"nodeType": "FunctionDefinition",
"src": "2123:54:76",
"nodes": [],
"functionSelector": "01418205",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "totalYield",
"nameLocation": "2132:10:76",
"parameters": {
"id": 35793,
"nodeType": "ParameterList",
"parameters": [],
"src": "2142:2:76"
},
"returnParameters": {
"id": 35796,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35795,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35797,
"src": "2168:7:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35794,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2168:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2167:9:76"
},
"scope": 35829,
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"id": 35802,
"nodeType": "FunctionDefinition",
"src": "2258:57:76",
"nodes": [],
"functionSelector": "8471c44d",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "totalYieldUSD",
"nameLocation": "2267:13:76",
"parameters": {
"id": 35798,
"nodeType": "ParameterList",
"parameters": [],
"src": "2280:2:76"
},
"returnParameters": {
"id": 35801,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35800,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35802,
"src": "2306:7:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35799,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2306:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2305:9:76"
},
"scope": 35829,
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"id": 35809,
"nodeType": "FunctionDefinition",
"src": "2405:68:76",
"nodes": [],
"functionSelector": "64c33977",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getYield",
"nameLocation": "2414:8:76",
"parameters": {
"id": 35805,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35804,
"mutability": "mutable",
"name": "_address",
"nameLocation": "2431:8:76",
"nodeType": "VariableDeclaration",
"scope": 35809,
"src": "2423:16:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 35803,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2423:7:76",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "2422:18:76"
},
"returnParameters": {
"id": 35808,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35807,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35809,
"src": "2464:7:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35806,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2464:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2463:9:76"
},
"scope": 35829,
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"id": 35814,
"nodeType": "FunctionDefinition",
"src": "2550:50:76",
"nodes": [],
"functionSelector": "d2cbf7ad",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getAPY",
"nameLocation": "2559:6:76",
"parameters": {
"id": 35810,
"nodeType": "ParameterList",
"parameters": [],
"src": "2565:2:76"
},
"returnParameters": {
"id": 35813,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35812,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35814,
"src": "2591:7:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35811,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2591:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2590:9:76"
},
"scope": 35829,
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"id": 35821,
"nodeType": "FunctionDefinition",
"src": "2664:107:76",
"nodes": [],
"functionSelector": "4b5a2465",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "convertToAsset",
"nameLocation": "2673:14:76",
"parameters": {
"id": 35817,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35816,
"mutability": "mutable",
"name": "_amountYieldAsset",
"nameLocation": "2696:17:76",
"nodeType": "VariableDeclaration",
"scope": 35821,
"src": "2688:25:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35815,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2688:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2687:27:76"
},
"returnParameters": {
"id": 35820,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35819,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35821,
"src": "2762:7:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35818,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2762:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2761:9:76"
},
"scope": 35829,
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"id": 35828,
"nodeType": "FunctionDefinition",
"src": "2835:107:76",
"nodes": [],
"functionSelector": "f8d368ee",
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "convertToYieldAsset",
"nameLocation": "2844:19:76",
"parameters": {
"id": 35824,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35823,
"mutability": "mutable",
"name": "_amountAsset",
"nameLocation": "2872:12:76",
"nodeType": "VariableDeclaration",
"scope": 35828,
"src": "2864:20:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35822,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2864:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2863:22:76"
},
"returnParameters": {
"id": 35827,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 35826,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 35828,
"src": "2933:7:76",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 35825,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2933:7:76",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2932:9:76"
},
"scope": 35829,
"stateMutability": "view",
"virtual": false,
"visibility": "external"
}
],
"abstract": false,
"baseContracts": [
{
"baseName": {
"id": 35714,
"name": "IERC20MetadataUpgradeable",
"nodeType": "IdentifierPath",
"referencedDeclaration": 28094,
"src": "468:25:76"
},
"id": 35715,
"nodeType": "InheritanceSpecifier",
"src": "468:25:76"
}
],
"canonicalName": "GreenTokenVaultInterface",
"contractDependencies": [],
"contractKind": "interface",
"fullyImplemented": false,
"linearizedBaseContracts": [
35829,
28094,
27348
],
"name": "GreenTokenVaultInterface",
"nameLocation": "440:24:76",
"scope": 35830,
"usedErrors": []
}
],
"license": "Apache-2.0"
},
"id": 76
}
Depositing into vault
Let’s start with a simple example where we render a component that attempts to deposit 1 token (assuming 18 decimals) to the vault when clicked on.
depositETH
instead if you are integrating with a native token like ETH or Celoimport { ethers } from "ethers";
import {useAccount, useSigner, useContractWrite, usePrepareContractWrite} from "wagmi";
import ImpactVaultInterface from "~/abis/ImpactVaultInterface.json";
export const MyComponent = () => {
const { address } = useAccount();
const { signer } = useSigner();
const { config: depositConfig } = usePrepareContractWrite({
addressOrName: "",
contractInterface: ImpactVaultInterface.abi,
functionName: "deposit",
signerOrProvider: signer,
args: [ethers.utils.parseEther("1"), address],
});
const { write: deposit } = useContractWrite({
...depositConfig,
onSuccess: async (data: any) => {
console.log("wallet prompt success");
const res = await data.wait();
if (res.status === 1) {
console.log("txn success");
} else {
console.log("txn error");
}
},
onError: error => {
console.log("wallet prompt error");
},
});
return (
Deposit 1 token
);
}
Reading gToken balance
Great! Now we can also read the gToken balance like any other ERC-20 token
contract. Doing this is simple with Wagmi using the useBalance
hook.
import { ethers } from "ethers";
import {useAccount, useBalance} from "wagmi";
export const MyComponent = () => {
const { address } = useAccount();
const { data: gTokenBalance, refetch: refetchBalance } = useBalance({
addressOrName: address,
token: ""
});
return (
gToken balance {gTokenBalance.formatted}
);
}
Let’s merge this with the first snippet so that after we deposit we refetch the user’s gToken balance and see it change!
Putting it together
import { ethers } from "ethers";
import {useAccount, useSigner, useBalance, useContractWrite, usePrepareContractWrite} from "wagmi";
import ImpactVaultInterface from "~/abis/ImpactVaultInterface.json";
export const MyComponent = () => {
const { address } = useAccount();
const { signer } = useSigner();
const { data: gTokenBalance, refetch: refetchBalance } = useBalance({
addressOrName: address,
token: ""
});
console.log(`pre-deposit gToken balance: ${gTokenBalance?.formatted}`);
const { config: depositConfig } = usePrepareContractWrite({
addressOrName: "",
contractInterface: ImpactVaultInterface.abi,
functionName: "deposit",
signerOrProvider: signer,
args: [ethers.utils.parseEther("1"), address],
});
const { write: deposit } = useContractWrite({
...depositConfig,
onSuccess: async (data: any) => {
console.log("wallet prompt success");
const res = await data.wait();
if (res.status === 1) {
console.log("txn success");
await refetchBalance();
console.log(`post-deposit gToken balance: ${gTokenBalance?.formatted}`);
} else {
console.log("txn error");
}
},
onError: error => {
console.log("wallet prompt error");
},
});
return (
Deposit 1 token
gToken balance {gTokenBalance.formatted}
);
}
Woo! Now we have a full end-to-end example of a front-end dapp that deposits an ERC-20 token into the gToken vault and refetches the user’s gToken balance 😤