Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade the SmartPy Compiler #16

Open
wants to merge 2 commits into
base: keefer/param-validation
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/setup-python@v2
- name: "Install SmartPy"
run: |
curl -s https://smartpy.io/releases/20210326-d2f24290eef00fe8cc3d482f052165a71a635fa3/cli/install.sh | sh -s -- local-install ~/smartpy-cli
curl -s https://smartpy.io/releases/20220405-79018120fafa35774b674ec4de0aebd19409219d/cli/install.sh | sh -s -- local-install ~/smartpy-cli
- name: "Build and Test Smart Contracts"
run: |
cd smart_contracts
Expand Down
2 changes: 1 addition & 1 deletion smart_contracts/common/historical-outcomes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import smartpy as sp

Poll = sp.import_script_from_url("file:common/poll.py")
Poll = sp.io.import_script_from_url("file:common/poll.py")

# A historical result of a vote.
# Params:
Expand Down
6 changes: 3 additions & 3 deletions smart_contracts/common/poll.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import smartpy as sp

Proposal = sp.import_script_from_url("file:common/proposal.py")
QuorumCap = sp.import_script_from_url("file:common/quorum-cap.py")
VoteRecord = sp.import_script_from_url("file:common/vote-record.py")
Proposal = sp.io.import_script_from_url("file:common/proposal.py")
QuorumCap = sp.io.import_script_from_url("file:common/quorum-cap.py")
VoteRecord = sp.io.import_script_from_url("file:common/vote-record.py")

# A poll for a proposal.
# Params:
Expand Down
24 changes: 13 additions & 11 deletions smart_contracts/community-fund.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
################################################################
################################################################

Addresses = sp.import_script_from_url("file:./test-helpers/addresses.py")
Errors = sp.import_script_from_url("file:common/errors.py")
Addresses = sp.io.import_script_from_url("file:./test-helpers/addresses.py")
Errors = sp.io.import_script_from_url("file:common/errors.py")

# A community fund for KOL tokens managed by the DAO.
class CommunityFund(sp.Contract):
Expand All @@ -16,7 +16,7 @@ def __init__(
tokenContractAddress = Addresses.TOKEN_CONTRACT_ADDRESS,
governorAddress = Addresses.GOVERNOR_ADDRESS
):
metadata_data = sp.bytes_of_string('{ "name": "Kolibri DAO Community Fund", "description": "Governance Token Fund for Kolibri DAO", "authors": ["Hover Labs <[email protected]>"], "homepage": "https://kolibri.finance" }')
metadata_data = sp.utils.bytes_of_string('{ "name": "Kolibri DAO Community Fund", "description": "Governance Token Fund for Kolibri DAO", "authors": ["Hover Labs <[email protected]>"], "homepage": "https://kolibri.finance" }')

metadata = sp.big_map(
l = {
Expand Down Expand Up @@ -165,10 +165,10 @@ def setDelegate(self, newDelegate):
# Only run tests if this file is main.
if __name__ == "__main__":

Dummy = sp.import_script_from_url("file:./test-helpers/dummy.py")
FA12 = sp.import_script_from_url("file:./test-helpers/fa12.py")
FA2 = sp.import_script_from_url("file:./test-helpers/fa2.py")
Token = sp.import_script_from_url("file:./token.py")
Dummy = sp.io.import_script_from_url("file:./test-helpers/dummy.py")
FA12 = sp.io.import_script_from_url("file:./test-helpers/fa12.py")
FA2 = sp.io.import_script_from_url("file:./test-helpers/fa2.py")
Token = sp.io.import_script_from_url("file:./token.py")

################################################################
# Set Delegate
Expand All @@ -187,9 +187,10 @@ def test():
# WHEN setDelegate is called by someone other than the governor
# THEN the invocation fails.
notGovernor = Addresses.NULL_ADDRESS
delegate = sp.some(sp.key_hash("tz1abmz7jiCV2GH2u81LRrGgAFFgvQgiDiaf"))
delegate = sp.some(Addresses.BAKER_KEY_HASH)
scenario += fund.setDelegate(delegate).run(
sender = notGovernor,
voting_powers = Addresses.VOTING_POWERS,
valid = False
)

Expand All @@ -204,9 +205,10 @@ def test():
scenario += fund

# WHEN setDelegate is called by the administrator
delegate = sp.some(sp.key_hash("tz1abmz7jiCV2GH2u81LRrGgAFFgvQgiDiaf"))
delegate = sp.some(Addresses.BAKER_KEY_HASH)
scenario += fund.setDelegate(delegate).run(
sender = Addresses.GOVERNOR_ADDRESS,
voting_powers = Addresses.VOTING_POWERS,
)

# THEN the delegate is updated.
Expand All @@ -224,7 +226,7 @@ def test():
config = FA2.FA2_config()
token = FA2.FA2(
config = config,
metadata = sp.metadata_of_url("https://example.com"),
metadata = sp.utils.metadata_of_url("https://example.com"),
admin = Addresses.TOKEN_ADMIN_ADDRESS
)
scenario += token
Expand Down Expand Up @@ -275,7 +277,7 @@ def test():
config = FA2.FA2_config()
token = FA2.FA2(
config = config,
metadata = sp.metadata_of_url("https://example.com"),
metadata = sp.utils.metadata_of_url("https://example.com"),
admin = Addresses.TOKEN_ADMIN_ADDRESS
)
scenario += token
Expand Down
Loading