Interactions

Example calls directly to the GYSR core contracts

User executes a simple stake of ERC20 tokens into a pool

// get addresses and connect to contracts
const pool = await Pool.at('0xpool');
const stk = await ERC20.at('0xtoken');
const stakingmodule = await Pool.stakingModule();

// make sure tokens are approved
await stk.approve(stakingmodule, toWei('100'), { from: alice });

// alice stakes 100 tokens
await pool.stake(toWei('100'), [], [], { from: alice });

Pool controller funds rewards tokens for a pool

// get addresses and connect to contracts
const pool = await Pool.at('0xpool');
const rew = await ERC20.at('0xtoken');
const rewardmodule = await ERC20FriendlyRewardModule.at(Pool.rewardModule());

// make sure tokens are approved
await rew.approve(this.rewardmodule.address, toWei('5000'), { from: controller });

// controller funds 5000 tokens
await rewardmodule.fund(toWei('5000'), [], [], { from: controller });

More examples coming soon!

Last updated