mirror of
https://github.com/luxfi/uma.git
synced 2026-10-30 15:14:44 +00:00
* Only set non-default Request storage variables saves 10k gas for requestPrice * Save 1000 gas by exiting _getRequest early * Initial tests * Update OptimisticOracleLite.sol * Add request params to events * Remove customizeRequest, add bond and default liveness to requestPrice params * Add requestAndProposePriceFor * Add interface * Change name * Update OptimisticOracle.sol * Update packages/core/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol Co-authored-by: Chris Maree <[email protected]> * temp * Add callbacks * Update SkinnyOptimisticOracle.sol * Tests pass with Skinny OO * Add test cases about when a relay is both disputed and re-relayed, should not be able to settle twice * fix(insured-bridge): Instant relayer should only receive refund if they sped up valid relay * Update BridgePool.js * Fix clients * Update BridgePool.sol * Update BridgePool.sol * Update BridgePool.sol * Update BridgePool.sol * Update packages/core/contracts/insured-bridge/BridgePool.sol Co-authored-by: Chris Maree <[email protected]> * Update packages/insured-bridge-relayer/test/Relayer.ts Co-authored-by: Chris Maree <[email protected]> * Update packages/insured-bridge-relayer/src/Relayer.ts Co-authored-by: Chris Maree <[email protected]> * Update InsuredBridgeL1Client.ts * Merge master * Fix tests * Update FindContractVersion.ts * Update Arbitrum_CrossDomainEnabled.sol * Compiled contracts * WIP Signed-off-by: Nick Pai <[email protected]> * Clarify test cases * map relay ancillary data as bytes32 instead of bytes * Tests * Remove Disputed state * Include Relay state in hash * Store relay state in hash ``` ···························|·······························|·············|·············|·················|···············|·············· | BridgePool · relayDeposit · 332175 · 375995 · 362612 · 29 · - │ ···························|·······························|·············|·············|·················|···············|·············· | BridgePool · removeLiquidity · 70712 · 102702 · 85114 · 5 · - │ ···························|·······························|·············|·············|·················|···············|·············· | BridgePool · settleRelay · 174741 · 235642 · 212400 · 18 · - │ ···························|·······························|·············|·············|·················|···············|·············· | Bri ``` * Update BridgePool.sol * Update BridgePool.sol * Update BridgePool.sol * Add relay ancillary data hash to Relay event * Fix relay ancillary data hash * Clients done * Add priceRequestTime to relayData * L1Client stores priceRequestTime and relayId * Change Relayer to work with latest clients * Refactor tests to be more functional and have clearer default vars * Update BridgePool.sol * Update Relayer.ts * Update * Update packages/core/contracts/insured-bridge/BridgePool.sol Co-authored-by: Chris Maree <[email protected]> * Update BridgePool.sol * Update BridgePool.sol * Update packages/core/contracts/insured-bridge/BridgePool.sol Co-authored-by: Chris Maree <[email protected]> * lint * Update HardhatConfig.ts * feat(core): Bump compiler to 0.8.9 and silence trivial compile warnings - removed variable name shadowing by function params - removed names for unused function params - changed function state mutability levels * Update BalancerMock.sol * fix tests Co-authored-by: Chris Maree <[email protected]>
66 lines
2.3 KiB
Solidity
66 lines
2.3 KiB
Solidity
// SPDX-License-Identifier: AGPL-3.0-only
|
|
pragma solidity ^0.8.0;
|
|
|
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
|
|
/**
|
|
* @title Implements only the required ERC20 methods. This contract is used
|
|
* test how contracts handle ERC20 contracts that have not implemented `decimals()`
|
|
* @dev Mostly copied from Consensys EIP-20 implementation:
|
|
* https://github.com/ConsenSys/Tokens/blob/fdf687c69d998266a95f15216b1955a4965a0a6d/contracts/eip20/EIP20.sol
|
|
*/
|
|
contract BasicERC20 is IERC20 {
|
|
uint256 private constant MAX_UINT256 = 2**256 - 1;
|
|
mapping(address => uint256) public balances;
|
|
mapping(address => mapping(address => uint256)) public allowed;
|
|
|
|
uint256 private _totalSupply;
|
|
|
|
constructor(uint256 _initialAmount) {
|
|
balances[msg.sender] = _initialAmount;
|
|
_totalSupply = _initialAmount;
|
|
}
|
|
|
|
function totalSupply() public view override returns (uint256) {
|
|
return _totalSupply;
|
|
}
|
|
|
|
function transfer(address _to, uint256 _value) public override returns (bool success) {
|
|
require(balances[msg.sender] >= _value);
|
|
balances[msg.sender] -= _value;
|
|
balances[_to] += _value;
|
|
emit Transfer(msg.sender, _to, _value);
|
|
return true;
|
|
}
|
|
|
|
function transferFrom(
|
|
address _from,
|
|
address _to,
|
|
uint256 _value
|
|
) public override returns (bool success) {
|
|
uint256 _allowance = allowed[_from][msg.sender];
|
|
require(balances[_from] >= _value && _allowance >= _value);
|
|
balances[_to] += _value;
|
|
balances[_from] -= _value;
|
|
if (_allowance < MAX_UINT256) {
|
|
allowed[_from][msg.sender] -= _value;
|
|
}
|
|
emit Transfer(_from, _to, _value); //solhint-disable-line indent, no-unused-vars
|
|
return true;
|
|
}
|
|
|
|
function balanceOf(address _owner) public view override returns (uint256 balance) {
|
|
return balances[_owner];
|
|
}
|
|
|
|
function approve(address _spender, uint256 _value) public override returns (bool success) {
|
|
allowed[msg.sender][_spender] = _value;
|
|
emit Approval(msg.sender, _spender, _value); //solhint-disable-line indent, no-unused-vars
|
|
return true;
|
|
}
|
|
|
|
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
|
|
return allowed[_owner][_spender];
|
|
}
|
|
}
|