Skip to main content

pOLY

Git Source

Inherits: IPOLY, Policy, RolesConsumer

State Variables

MINTR

MINTRv1 public MINTR;

TRSRY

TRSRYv1 public TRSRY;

previous

IPreviousPOLY public previous;

previousGenesis

IGenesisClaim public previousGenesis;

OHM

ERC20 public OHM;

gOHM

IgOHM public gOHM;

DAI

ERC20 public DAI;

dao

address public dao;

terms

mapping(address => Term) public terms;

walletChange

mapping(address => address) public walletChange;

totalAllocated

uint256 public totalAllocated;

maximumAllocated

uint256 public maximumAllocated;

PERCENT_PRECISION

uint256 public constant PERCENT_PRECISION = 1_000_000;

OHM_PRECISION

uint256 public constant OHM_PRECISION = 1_000_000_000;

DAI_PRECISION

uint256 public constant DAI_PRECISION = 1_000_000_000_000_000_000;

Functions

constructor

constructor(
Kernel kernel_,
address previous_,
address previousGenesis_,
address ohm_,
address gohm_,
address dai_,
address dao_,
uint256 maximumAllocated_
) Policy(kernel_);

configureDependencies

Define module dependencies for this policy.

function configureDependencies() external override returns (Keycode[] memory dependencies);

Returns

NameTypeDescription
dependenciesKeycode[]- Keycode array of module dependencies.

requestPermissions

Function called by kernel to set module function permissions.

function requestPermissions() external view override returns (Permissions[] memory permissions);

Returns

NameTypeDescription
permissionsPermissions[]requests - Array of keycodes and function selectors for requested permissions.

claim

Claims vested OHM by exchanging DAI

function claim(address to_, uint256 amount_) external;

Parameters

NameTypeDescription
to_addressAddress to send OHM to
amount_uint256DAI amount to exchange for OHM

pushWalletChange

Pushes entirety of a user's claim to a new address

function pushWalletChange(address newAddress_) external;

Parameters

NameTypeDescription
newAddress_addressAddress to send claim to

pullWalletChange

Pulls a queued wallet change

function pullWalletChange(address oldAddress_) external;

Parameters

NameTypeDescription
oldAddress_addressAddress to pull change from

redeemableFor

Calculates the current amount a user is eligible to redeem

function redeemableFor(address account_) public view returns (uint256);

Parameters

NameTypeDescription
account_addressThe account to check the redeemable amount for

Returns

NameTypeDescription
<none>uint256uint256 The amount of OHM the account can redeem

redeemableFor

Calculates the current amount a user is eligible to redeem

function redeemableFor(Term memory accountTerms_) public view returns (uint256);

Parameters

NameTypeDescription
accountTerms_Term

Returns

NameTypeDescription
<none>uint256uint256 The amount of OHM the account can redeem

getCirculatingSupply

Returns a calculation of OHM circulating supply to be used to determine vested positions

function getCirculatingSupply() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256uint256 OHM circulating supply

getAccountClaimed

Calculates the effective amount of OHM claimed taking into consideration rebasing since claim

function getAccountClaimed(address account_) public view returns (uint256);

Parameters

NameTypeDescription
account_addressThe account to check the claim for

Returns

NameTypeDescription
<none>uint256uint256 The amount of OHM the account has claimed

getAccountClaimed

Calculates the effective amount of OHM claimed taking into consideration rebasing since claim

function getAccountClaimed(Term memory accountTerms_) public view returns (uint256);

Parameters

NameTypeDescription
accountTerms_Term

Returns

NameTypeDescription
<none>uint256uint256 The amount of OHM the account has claimed

validateClaim

Calculates the amount of OHM to send to the user and validates the claim

function validateClaim(uint256 amount_, Term memory accountTerms_) public view returns (uint256);

Parameters

NameTypeDescription
amount_uint256The amount of DAI to exchange for OHM
accountTerms_TermThe terms to check the claim against

Returns

NameTypeDescription
<none>uint256uint256 The amount of OHM to send to the user

migrate

Migrates claim data from old pOLY contracts to this one

function migrate(address[] calldata accounts_) external onlyRole("poly_admin");

Parameters

NameTypeDescription
accounts_address[]Array of accounts to migrate

migrateGenesis

Migrates claim data from the Genesis Claim contract to this one

The Genesis Claim contract originally did not count the full claimed amount as staked, only 90% of it, given that there is no longer a staking rate, we can combine the two claim contracts by counting the 10% that wasn't considered staked as staked at the current index

function migrateGenesis(address[] calldata accounts_) external onlyRole("poly_admin");

Parameters

NameTypeDescription
accounts_address[]Array of accounts to migrate

setTerms

Sets the claim terms for an account

function setTerms(address account_, uint256 percent_, uint256 gClaimed_, uint256 max_) public onlyRole("poly_admin");

Parameters

NameTypeDescription
account_addressThe account to set the terms for
percent_uint256The percent of the circulating supply the account is entitled to
gClaimed_uint256The amount of gOHM the account has claimed
max_uint256The maximum amount of OHM the account can claim

_claim

function _claim(uint256 amount_) internal returns (uint256 toSend);