4. Deposit DAI into Public Pool
Last updated
{
"inputs": [{
"internalType": "uint256",
"name": "mintAmount",
"type": "uint256"
}],
"name": "provide",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}var Web3 = require('web3');
const BigNumber = require('bignumber.js');
// BSC Mainnet: https://bsc-dataseed.binance.org
// BSC Testnet: https://data-seed-prebsc-1-s1.binance.org:8545
const web3 = new Web3("https://data-seed-prebsc-1-s1.binance.org:8545");
const CONTRACT_ADDRESS = "Replace with Public Pool Contract Address";
const ABI = [{
"inputs": [{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}],
"name": "deposit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}];
// Deposit 1 DAI to public pool.
const DEPOSIT_AMOUNT = 1e18;
var contract = new web3.eth.Contract(ABI, CONTRACT_ADDRESS);
contract.methods.provide(new BigNumber(DEPOSIT_AMOUNT).toString()).send({
from: "CALLER_ADDRESS",
}, function(error, result){
if(!error) {
console.log('Response:', result);
} else {
console.log(error);
}
});# This example is written by using Web3.py
# More details on Web3.py could be found here - https://web3py.readthedocs.io/
{
"id":64,
"jsonrpc": "2.0",
"result": "0x146695866343024d1ad9854a72904d16abec8b1597e098619d2addbd44b14e4c"
}