Offer provisions
How taker compensation for failing offers works.
Summary
Balance funding & withdrawal
Funding an offer
function fund(address maker) public payable;// Offer Maker at address `maker` has been credited of `amount` wei
event Credit(address maker, uint amount);"mgv/dead" // Mangrove contract is no longer liveimport "src/IMangrove.sol";
//context
IMangrove mgv; // Mangrove contract address
address maker_contract; // address of the maker contract one is willing to provision
// funding maker_contract
mgv.fund{value: 0.1 ether}(maker_contract);
// if funding oneself one can use the overload:
mgv.fund{value: 0.1 ether}();
// which is equivalent to `msg.fund{value:0.1 ether}(address(this))
// to avoid erreoneous transfer of native tokens to Mangrove, the fallback function will also credit `msg.sender`:
(bool noRevert,) = address(mgv).call{value: amount}("");
require(noRevert, "transfer failed");const { ethers } = require("ethers");
//context
let MGV; // address of Mangrove
let MGV_abi; // Mangrove contract's abi
let maker_contract_address; // address of the Maker Contract
const Mangrove = new ethers.Contract(
MGV,
MGV_abi,
ethers.provider
);
let overrides = { value: ethers.parseUnits("0.1", 18) };
// provisioning Mangrove on behalf of MakerContract
await Mangrove["fund(address)"](maker_contract_address, overrides);Inputs
Checking an account balance
Inputs
Outputs
Withdrawing
Inputs
Outputs
Balance adjustment when creating/updating offers
Provision and offer bounty
Last updated
Was this helpful?